<%
	String total_date = RequestUtil.getStringParameter(request ,"total_date" ,"");
	String processes_id = RequestUtil.getStringParameter(request ,"processes_id" ,"");
	String processes_name = RequestUtil.getStringParameter(request ,"processes_name" ,"");
%>
<table>
	<tr>
		<td width="70px" align="right">
			<eam:message key="column.processes_ration_total.processes_ration_total.total_date"/>*:&nbsp;
		</td>
		<td width="70px" align="left">
			<input type="text" id="total_date" name="total_date" onblur="checkYearMonth(this)" style="text-align:center;" style="width:100%" class="formEdit" value="<%= total_date%>"/>
		</td>
		<td width="70px" align="right">
			<eam:message key="column.processes_ration_total.processes_ration_total.processes_name"/>*:&nbsp;
		</td>
		<td width="200px" align="left">
		<input name="processes_ration_total.processes_name" id="processes_name" readOnly="readOnly" disabled="disabled" type="text" class="formDisabled" style="width:88%"/>
		<eam:createSelectwin _ID="processes_ration_total.processes_name" _controlCode="baseprocesses" _colextID="" />
		<input name="processes_ration_total.processes_id" id="processes_id" type="hidden" value="<%= processes_id%>"/>
		</td>
		<td width="50px" align="center">
			<input type="button" id="total" value='<eam:message key="btn.keyquery"/>' onclick="f_query()">
		</td>
		<td width="50px" align="center">
			<input type="button" id="download1" value='<eam:message key="text.total.outexcel"/>' onclick="f_forestat()" >
		</td>
	</tr>
</table>
<form method=post action="/wzmis/pageJumpAction.do" name="frmSel" id="frmSel" style="height:1px;display:none;">
	<input type="hidden" name="pageType" id="pageType" value="">
	<input type="hidden" name="funcid" id="funcid" value="">	
	<input type="hidden" name="parent_where_sql" id="parent_where_sql" value=""/>
	<input type="hidden" name="where_sql" id="where_sql" value=""/>
	<input type="hidden" name="where_value" value="" id="where_value"/>
	<input type="hidden" name="where_type" value="" id="where_type"/>	
	<input type="hidden" name="orgwhere_sql" id="orgwhere_sql" value=""/>
	<input type="hidden" name="orgwhere_type" id="orgwhere_type" value=""/>
	<input type="hidden" name="orgwhere_value" id="orgwhere_value" value=""/> 
	<input type="hidden" name="selOrgCols" id="selOrgCols" value=""/>
	<input type="hidden" name="selSrcCols" id="selSrcCols" value=""/> 
	<input type="hidden" name="isSetdefaultval" id="isSetdefaultval" value=""/>
	<input type="hidden" name="isMoreselect" id="isMoreselect" value=""/> 
	<input type="hidden" name="parentRightFuncid" id="parentRightFuncid" value=""/>
	<input type="hidden" name="selextend_param" id="selextend_param" value=""/>
	<input type="hidden" name="layoutPage" id="layoutPage" value=""/>
</form>
<form method=post action="<%= CONTEXTPATH%>/wzmis/stat/grid_processes_ration_total2.jsp" name="frmTotal" id="frmTotal" style="height:1px;display:none;">
</form>
<script language="javascript">
<!--
	function f_initOther(){	
		var total_date = '<%=total_date%>';
		var processes_name = '<%= processes_name%>';
		if (!total_date){
			document.getElementById("total_date").value=getBeforeYearMonth();
		}
		if (processes_name){
			document.getElementById("processes_name").value=processes_name;
		}
	}
	function f_query(){
		var totalDateObj = document.getElementById("total_date");
		var processesIdObj = document.getElementById("processes_id");
		var processesNameObj = document.getElementById("processes_name");
		if (!totalDateObj.value){
			alert('<eam:message key="sjtotal.err.input"/><eam:message key="column.processes_ration_total.processes_ration_total.total_date"/>');
			totalDateObj.focus();
			return;
		}
		else if(!checkYearMonth(totalDateObj)){
			return;
		}
		else if (!processesIdObj.value){
			alert('<eam:message key="sjtotal.err.input"/><eam:message key="column.processes_ration_total.processes_ration_total.processes_name"/>');
			processesNameObj.focus();
			return;
		}
		var totalDateArr = totalDateObj.value.split('-');
		var totalDateStr = totalDateArr[0]+"-"+totalDateArr[1]*1;
		var url = "<%= CONTEXTPATH%>/wzmis/stat/grid_processes_ration_total.jsp?funcid=processes_ration_total"+
				  "&where_sql=(total_date=?+or+total_date=?)+and+processes_id=?"+
				  "&where_value="+totalDateObj.value+";"+totalDateStr+";"+processesIdObj.value+
				  "&where_type=string;string;string"+
				  "&total_date="+totalDateObj.value+
				  "&processes_id="+processesIdObj.value+
				  "&processes_name="+processesNameObj.value;
		document.location.href = url;
	}
	
	function f_forestat() {
		var totalDateObj = document.getElementById("total_date");
		var processesIdObj = document.getElementById("processes_id");
		var processesNameObj = document.getElementById("processes_name");
		if (!totalDateObj.value){
			alert('<eam:message key="sjtotal.err.input"/><eam:message key="column.processes_ration_total.processes_ration_total.total_date"/>');
			totalDateObj.focus();
			return;
		}
		else if(!checkYearMonth(totalDateObj)){
			return;
		}
		else if (!processesIdObj.value){
			alert('<eam:message key="sjtotal.err.input"/><eam:message key="column.processes_ration_total.processes_ration_total.processes_name"/>');
			processesNameObj.focus();
			return;
		}
		var totalDateArr = totalDateObj.value.split('-');
		var totalDateStr = totalDateArr[0]+"-"+totalDateArr[1]*1;
		var url = "<%= CONTEXTPATH%>/wzmis/stat/grid_processes_ration_total2.jsp?funcid=processes_ration_total"+
				  "&where_sql=(total_date=?+or+total_date=?)+and+processes_id=?"+
				  "&where_value="+totalDateObj.value+";"+totalDateStr+";"+processesIdObj.value+
				  "&where_type=string;string;string"+
				  "&total_date="+totalDateObj.value+
				  "&processes_id="+processesIdObj.value+
				  "&processes_name="+processesNameObj.value;
		var formObj = document.forms("frmTotal");
		formObj.action=url;
		formObj.submit();
		return false;
	}
	function checkYearMonth(obj) {
		var value = obj.value;
		var isPass = false;
		if (value){
			var reg = new RegExp("^([1-9]{1}[0-9]{1,3})\-[0-9]{1,2}$","g");
			isPass = reg.test(value);
			if (!isPass){
				alert('<eam:message key="common.text.invyearmonth" />');
			}
		}
		if (!isPass && value) obj.focus();
		return isPass;
	}
//-->
</script>